package web.study.struts2.action;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport
{
    /**
     * 序列化
     */
    private static final long serialVersionUID = 1L;
    
    private String username;
    
    private String password;
    
    @Override
    public String execute()
        throws Exception
    {
        // struts执行方法体
        return super.execute();
    }
    
    @Override
    public void validate()
    {
        if(null == username || "".equals(username))
        {
            this.addFieldError("username", this.getText("HELLOWORLD_USERNAME_NULL"));
        }
        
        if(null == password || "".equals(password))
        {
            this.addFieldError("password", this.getText("HELLOWORLD_PASSWORD_NULL"));
        }
    }
    
    public String getUsername()
    {
        return username;
    }
    
    public void setUsername(String username)
    {
        this.username = username;
    }
    
    public String getPassword()
    {
        return password;
    }
    
    public void setPassword(String password)
    {
        this.password = password;
    }
}
